<template>
  <div>
    <el-button type="text" @click="invoiceTitleShow">详情</el-button>
    <el-dialog title="标签信息" :visible.sync="dialogVisible" width="60%">
      <!--开票申请信息-->
      <div class="padding">商品信息</div>
      <el-table :data="invoiceListDetails" style="width: 100%">
        <el-table-column prop="intaxname" label="税务名称"> </el-table-column>
        <el-table-column prop="intaxrate" label="税率"> </el-table-column>
        <el-table-column prop="intaxmeasure" label="规格"></el-table-column>
        <el-table-column prop="intaxnum" label="数量"> </el-table-column>
        <el-table-column prop="intaxproduct" label="单位"> </el-table-column>
        <el-table-column prop="intaxprice" label="单价"> </el-table-column>
        <el-table-column prop="intaxratetotal" label="含税合计">
        </el-table-column>
        <el-table-column prop="intaxtotalmoney" label="不含税合计">
        </el-table-column>
      </el-table>
      <!--开票响应结果-->
      <div class="padding">诺诺开票结果</div>
      <el-table :data="invoiceOrderResult" style="width: 100%">
        <el-table-column prop="status" label="状态"> </el-table-column>
        <el-table-column prop="fpqqlsh" label="流水号"> </el-table-column>
        <el-table-column prop="message" label="日志"></el-table-column>
      </el-table>
      <!-- 发票详情 -->
      <div class="padding">诺诺开票查询结果</div>
      <el-table :data="tableData" style="width: 100%">
        <el-table-column prop="hbsje" label="开票金额" show-overflow-tooltip>
        </el-table-column>
        <el-table-column
          prop="kprq"
          label="开票时间"
          show-overflow-tooltip
        ></el-table-column>
        <el-table-column prop="fphm" label="发票号码" show-overflow-tooltip>
        </el-table-column>
        <el-table-column prop="finshurl" label="标签" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-link type="primary" :href="scope.row['finshurl']">pdf</el-link>
          </template>
        </el-table-column>
        <el-table-column prop="status" label="状态" show-overflow-tooltip>
        </el-table-column>
        <el-table-column prop="sysremake" label="日志" show-overflow-tooltip>
        </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>
<script>
import { ajax } from "@/store/yg/common/utils";

export default {
  props: ["row", "data", "more"],
  data() {
    return {
      dialogVisible: false,
      tableData: [], // 开票查询结果
      invoiceOrderResult: [], // 开票结果
      invoiceListDetails: [] // 开票信息
    };
  },
  mounted() {
    // console.log(this.data);
  },
  methods: {
    async init() {
      const {
        code,
        data = {},
        data2,
        data3,
        message
      } = await ajax("viewInvoiceTitlelabelUrls", { id: this.data.id });
      if (code !== 200) {
        this.$message.error(message);
        return;
      }
      // debugger;
      this.tableData = data.invoiceTitles;
      let orderResult = new Array();
      if (data.invoiceOrderResult) {
        orderResult.push(data.invoiceOrderResult);
        this.invoiceOrderResult = orderResult;
      }

      this.invoiceListDetails = data.invoiceListDetails;
      console.log(this.invoiceOrderResult);
      var statusMap = data3;
      for (var i = 0; i < this.tableData.length; i++) {
        this.tableData[i].url = "pdf";
        let status = this.tableData[i].status;
        this.tableData[i].status = statusMap[status];
      }
    },
    invoiceTitleShow() {
      this.init();
      // debugger;
      this.dialogVisible = true;
    }
  }
};
</script>
<style scoped>
.row-item >>> .el-col {
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
/deep/ .el-form-item__content {
  font-size: 12px;
}

/deep/ .el-autocomplete {
  width: 100%;
}
</style>

<style lang="scss">
.row-item {
  color: #3f4652;
  line-height: 28px;
  margin-bottom: 14px;
}
</style>
